Connecting to SOLIS

There are several tools and languages one can use to interface with SOLIS. In this documentation, we will show how to connect to SOLIS with Windows PowerShell, Python, C#, and MATLAB. SolisConnect is the entry point for the SOLIS Automation/Scripting application programming interface (API).

Windows PowerShell

These examples will use the SOLIS Example Automation scenario from the "ExampleScenarios" folder provided in C:\ProgramData\AGI\STK 12\SOLIS\. To follow along, in SOLIS, click the Configuration Manager to force SOLIS to generate the default objects if not done already. The following actions will be performed:

Windows PowerShell is a utility in Windows that includes a scripting language which can be used to control spacecraft simulations in SOLIS. To launch PowerShell, press Windows Key + R, then in the Run dialog box, type "powershell.exe" and click the OK button. Additionally, PowerShell scripts can be written, and have the file extension .ps1.

Getting Ready to Connect to SOLIS

In order to use the automation functionality, a client program must first load the SOLIS dynamic link library (DLL). Though not required, it is recommended to click the Configuration Management on the left in SOLIS in order to create all default components if these are not already created.

Before establishing a connection, the SOLIS user interface must be up and running in STK.

Add-Type -Path "C:\Program Files\AGI\STK 12\Solis\bin\STKSolisLib.dll"; # Load the DLL

Connecting to SOLIS

A SolisConnect object must be created to connect to SOLIS.

$obj = New-Object STKSolis.SolisConnect; # Connect to SOLIS $satNames = $obj.SatelliteNames; $satNames # Check what Satellites are in scenario $sat = $obj.GetSatellite($satNames[0]); # Get Landmapper_BC satellite`

If ServiceHost exceptions or freezing of STK and SOLIS UI are encountered, please exit STK between runs.

Python

Setup

  1. If not already installed, install Python from python.org PythonNet only supports up to python version 3.8.
  2. Install pip if necessary
  3. Install Python for .NET. In a command prompt, enter the command pip install pythonnet

Getting Ready to Connect to SOLIS

In order to use the automation functionality, a client program must first load the SOLIS dynamic link library (DLL). Though not required, it is recommended to click the Configuration Management on the left in SOLIS in order to create all default components if these are not already created.

Before establishing a connection, the SOLIS user interface must be up and running in STK.

import clr # import Python for .NET clr.AddReference('C:/Program Files/AGI/STK 12/Solis/bin/STKSolisLib.dll') # Load the DLL

Connecting to SOLIS

A SolisConnect object must be created to connect to SOLIS.

# Import necessary modules from STKSolis import SolisConnect from System import Array # For changing quaternion, vector, and matrix parameter values obj = SolisConnect() # Connect to SOLIS satNames = list(obj.SatelliteNames)print(satNames) # Check what Satellites are in scenario sat = obj.GetSatellite(satNames[0]) # Get Landmapper_BC satellite` print(satNames) # Check what Satellites are in scenario

Python and PythonNet will not immediately dispose the client connections to the server. If ServiceHost exceptions or freezing of STK and SOLIS UI are encountered, please exit STK between runs.

C#

Setup

To use C#, it is recommended to have installed the Visual Studio Integrated Development Environment (IDE) or some other IDE that can compile C# code. This documentation will outline instructions for creating a C# automation program in Visual Studio. To create a new project:

  1. Launch Visual Studio. Click File, hover over New, then click Project...
  2. Find and select Visual C# under Templates on the left, then choose Console App (.NET Core)
  3. Change the name of the project, then click OK
After creating the project, it's useful to import the Automation.Common namespace from SOLIS when working with quaternion, vector, matrix, and filter parameter types. See the below code example for how to do this.

Getting Ready to Connect to SOLIS

In order to use the automation functionality, a client program must first load the SOLIS dynamic link library (DLL). Though not required, it is recommended to click the Configuration Management on the left in SOLIS in order to create all default components if these are not already created.

Before establishing a connection, the SOLIS user interface must be up and running in STK.

From the new C# project created in the Setup section, the SOLIS DLL must be added as a reference. This can be done through Visual Studio. From the Project file menu, click Add Reference.... Then, click Browse... and navigate to the path of and choose STKSolisLib.dll.

Connecting to SOLIS<

A SolisConnect object must be created to connect to SOLIS.

using STKSolis; using STKSolis.Automation.Common; // For Quaternion, Vector, Filter, and Matrix types // Wrap the client connection to SOLIS in a using statement. using (var obj = new SolisConnect();) var satNames = obj.SatelliteNames; foreach (var sName in satNames) Console.WriteLine(sName); // Check what Satellites are in scenario var sat = obj.GetSatellite(satNames[0]); // Get Landmapper_BC satellite`

MATLAB

Setup

  1. Install MATLAB
  2. P = genpath('C:\Program Files\AGI\STK 12\Solis\Scripts'); # Get all paths at and below Scripts
  3. addpath(P); # Add all paths within P to the MATLAB Path

Getting Ready to Connect to SOLIS

In order to use the automation functionality, a client program must first load the SOLIS dynamic link library (DLL). Though not required, it is recommended to click the Configuration Management on the left in SOLIS in order to create all default components if these are not already created.

Before establishing a connection, the SOLIS user interface must be up and running in STK.

Loading of the DLL is handled using the SOL_API_Connect.m function provided in C:\Program Files\AGI\STK 12\Solis\Scripts\SubFunctions.

SOLIS_Scenario = 'C:\ProgramData\AGI\STK 12\SOLIS\ExampleScenarios\SOLISExample_Automation\SOLISExample_Automation.sc'; STK = SOL_API_Connect(SOLIS_Scenario);

Connecting to SOLIS

A SolisConnect object must be created to connect to SOLIS.

STK.SatNames = StringArray2CellArray(STK.SOL_Connect.SatelliteNames()); %Get satellite names STK.SOL_Satellite = SOL_Choose_Satellite(); % Pick the satellite, or user-select which one STK.SOL_Satellite = STK.SOL_Connect.GetSatellite(STK.SatNames{1}); % Pick the specified satellite

If ServiceHost exceptions or freezing of STK and SOLIS UI are encountered, please exit STK between runs.